package edu.jd.block_chain.project.project;

import edu.jd.block_chain.common.Result;
import edu.jd.block_chain.security.register.Register;
import edu.jd.block_chain.security.register.RegisterService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @descriptions:
 * @data: 2021/11/23 10:29
 */

@RestController
@RequestMapping("/project")
public class ProjectAPI {
    @Resource
    private ProjectService projectService;


    @RequestMapping("/info")
    public Result getProjectInfo(@RequestBody ProjectDto projectdto){
        Project project= projectService.getProjectInfo(projectdto);
        return Result.success(project);
    }
    @RequestMapping("/show")
    public Result getProjectList(){
        List<Project> project= projectService.getProjectList();
        return Result.success(project);
    }

    @RequestMapping("/create")
    public Result addProject(@RequestBody ProjectDto projectdto){
        projectService.addProject(projectdto);
        return Result.success();
    }
    @RequestMapping("/count")
    public Result countProject(){
        int a= projectService.countProject();
        return Result.success(a);
    }
}






